package com.example.custinfoprovider.service.impl;

import com.example.custinfoprovider.mapper.CustInfoMapper;
import com.example.custinfoprovider.service.CustInfoService;
import com.example.custinfoprovider.entity.CustInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CustInfoServiceImpl implements CustInfoService {

    @Resource
    private CustInfoMapper custInfoMapper;

    @Override
    public List<CustInfo> selectCustomBySql(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        List<CustInfo> list = custInfoMapper.selectCustomBySql(map);
        return list;
    }

    @Override
    public Integer getTotal() {
        return custInfoMapper.getTotal();
    }
}
